﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace GameLib.Gameplay.Stories
{
	public delegate void StoryEventHandler();

	public class StoryManager
	{

		public void ActivateStory(Story story)
		{
			if (story == null)
				throw new ArgumentNullException();

			Story last = StoryStack.Pop();

			if (last != null)
				last.End(story);

			StoryStack.Push(story);

			story.Begin(last);
		}

		public Story CurrentStory
		{
			get { return StoryStack.Peek(); }
		}

		#region Events

		public event StoryEventHandler StoryBegin;
		public event StoryEventHandler StoryEnd;

		#endregion

		#region Private Fields

		private Stack<Story> StoryStack = new Stack<Story>();
		#endregion
	}
}
